/*
 * =====================================================================================
 *
 *       Filename:  LM.cpp
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  2015年03月31日 16时59分56秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  LiuYi (), swliuyi@gmail.com
 *   Organization:  
 *
 * =====================================================================================
 */
#include "LM.h"
using namespace std;
LM::LM(string path, int maxGramNum):m_maxGramNum(maxGramNum), m_pLM(NULL)
{
    void * temp = sriLoadLM(path.c_str(), 1, maxGramNum, 1, 0);
    if( temp == NULL )
    {
        cout<<"can't load lm: "<<path<<endl;
        return;
    }
    m_pLM = temp;
}

LM::~LM()
{
    if( m_pLM != NULL )
    {
        sriUnloadLM(m_pLM);
    }
}
